<template>
  <div class="table100">
    <div v-height>
      <el-table
        :data="enterpriselist"
        stripe
        style="width: 100%"
        height="100%"
        :header-cell-style="styleObj"
        :row-class-name="tableRowClassName"
      >
        <el-table-column type="index" label="序号" width="80">
        </el-table-column>
        <el-table-column prop="companyName" label="企业名称" width="180">
        </el-table-column>
        <el-table-column prop="longitude" label="法定代表人" width="100"> </el-table-column>
        <el-table-column prop="establishDate" label="注册日期" width="250"> </el-table-column>
        <el-table-column prop="capitalNum" label="注册资本"> </el-table-column>
        <el-table-column prop="insuranceAmount" label="社保人数"> </el-table-column>
        <el-table-column prop="address" label="状态">
          <template>
            <div class="zaiy">
              在营
            </div>
          </template> </el-table-column>
        <el-table-column prop="address" label="联系"> 
          <template>
            <div class="zxun">咨询</div>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="block">
      <el-pagination
        align="right"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[1, 5, 10, 20]"
        :page-size="pageSize"
        layout="  prev, pager, next, sizes "
        :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
// import vHeight from "@/utils/vHeight/vHeight"
export default {
  name: "tableComponents",
  props:['enterpriselist','total'],
  
  data() {
    return {
       
      currentPage: 1, // 当前页码 
      pageSize: 5, // 每页的数据条数
      styleObj: {
        color: "#000",
        background: "#F4F8FC",
        fontSize: "16px",
        fontFamily: "PingFangSC-Medium",
        fontWeight: 500
      },
    };
  },
  methods: {
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.currentPage = 1;
      this.pageSize = val;
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.currentPage = val;
      this.$emit("setPageNum",val)
    },
    tableRowClassName({ row, rowIndex }) {
      console.log(rowIndex, 'rowIndex');
      if (rowIndex % 2 == 0) {
        return 'even-row';
      } else {
        return 'odd-row';
      }
    },
  },
};
</script>
<style scoped lang="scss">
.table100 {
  display: flex;
  width: 100%;
  flex-direction: column;
  position: relative;
}
.block {
  margin-top: 10px;
}
.el-drawer__body {
  &::-webkit-scrollbar {
    width: 0;
  }
}
::v-deep .el-table .even-row td {
  background-color: #fff !important;
}

::v-deep .el-table .odd-row td {
  background-color: #f4f8fc !important;
}
.zaiy{
  font-family: Microsoft YaHei, Microsoft YaHei;
font-weight: 400;
font-size: 16px;
color: #24C84C;
}
.zxun{
  font-family: Microsoft YaHei, Microsoft YaHei;
font-weight: 400;
font-size: 16px;
color: #FF824B;
}
</style>
